extensions/gggl-lies: bump up accuracy of a conversion
authorØyvind Kolås <pippin@gimp.org>
Thu, 17 Nov 2016 12:09:54 +0000 (13:09 +0100)
committerØyvind Kolås <pippin@gimp.org>
Thu, 17 Nov 2016 12:10:07 +0000 (13:10 +0100)
extensions/gggl-lies.c

index 22d0fee96f8917a48f4ba91723a2b8c97c3f9811..5d50f5bffe10c71d8f0a684730a932d2c27a6ee8 100644 (file)
@@ -46,8 +46,6 @@
  * need this piece of code for projects where GPL compatibility
  * was a must.
  *
- * TODO: error diffusion,
- *       gamma correction  (not really,. gamma correction belongs in seperate ops,.
  */
 
 static long
@@ -635,7 +633,7 @@ conv_rgbA8_rgba8 (unsigned char *src, unsigned char *dst, long samples)
         }
       else
         {
-          unsigned int aa = ((255 << 16) + (src[3] >> 1)) / src[3];
+          unsigned int aa = ((255 << 16) - 255) / src[3];
           *dst++ = (src[0] * aa + 0x8000) >> 16;
           *dst++ = (src[1] * aa + 0x8000) >> 16;
           *dst++ = (src[2] * aa + 0x8000) >> 16;